package org.itboys.trade.service.mysql;

import java.util.List;
import java.util.Map;

import org.itboys.trade.dao.AdminAmountRecordMapper;
import org.itboys.trade.dao.UserWithdrawRecordMapper;
import org.itboys.trade.entity.mysql.AdminAmountRecord;
import org.itboys.trade.entity.mysql.UserWithdrawRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminAmountRecordService {
	
	@Autowired
	private AdminAmountRecordMapper mapper;
	
	public  List<AdminAmountRecord> list(Map<String, Object> search){
		return mapper.list(search);
	};
	public AdminAmountRecord getById(long id){
		return mapper.getById(id);
	};
	public Long count(Map<String, Object> search){
		return mapper.count(search);
	};
	public int insert(AdminAmountRecord record){
		return mapper.insert(record);
	};
	public int sellerWithdraw(Long sellerId,Double amount){
		return insert(new AdminAmountRecord(
				sellerId,
				AdminAmountRecord.objType_seller,
				AdminAmountRecord.tradeType_withdraw,
				0d,
				amount,
				null,
				null, 
				null, 
				null));
	}
	public int centerWithdraw(Long centerId,Double amount){
		return insert(new AdminAmountRecord(
				centerId,
				AdminAmountRecord.objType_center,
				AdminAmountRecord.tradeType_withdraw,
				0d,
				amount,
				null,
				null, 
				null, 
				null));
	}
}
